// custom-tab-bar/index.js
// 自定义tabBar官方文档：
// https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html

Component({
    data: {
        isEdit: true,
        selected: 0,
        color: "#777777",
        selectedColor: "#1989fa",
        list: [
            {
                text: "首页",
                pagePath: "pages/index/index",
               
            },
            {
                text: "分类",
                pagePath: "pages/classify/classify",
               
            },
            {
                text: "发布",
                pagePath: "pages/release/release",
                
            },
            {
                text: "我的",
                pagePath: "pages/user/user",
               
            },
        ],
    },
    attached() {

    },
    methods: {
        onChange(event) {
            this.setData({ active: event.detail });
            const data = this.data.list[event.detail]
            const url = '/' + data.pagePath;
            wx.switchTab({ url });
            this.setData({
                selected: event.detail,
            });
        },
    },
    lifetimes: {
        attached() {
           
        }
    }
});
